package com.lzy.mall.member.controller;


import com.lzy.mall.common.utils.ResultUtils;
import com.lzy.mall.member.entity.UmsMemberReceiveAddress;
import com.lzy.mall.member.service.UmsMemberReceiveAddressService;
import org.springframework.web.bind.annotation.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 会员收货地址(UmsMemberReceiveAddress)表控制层
 *
 * @author lzy
 * @since 2021-08-25 11:38:53
 */
@RestController
@RequestMapping("umsMemberReceiveAddress")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
public class UmsMemberReceiveAddressController {

    private final UmsMemberReceiveAddressService memberReceiveAddressService;

    @GetMapping("/{memberId}/addresses")
    List<UmsMemberReceiveAddress> getAddress(@PathVariable("memberId") Long memberId){
        return memberReceiveAddressService.getAddress(memberId);
    }
    @RequestMapping("/info/{id}")
    ResultUtils addrInfo(@PathVariable("id") Long id){
        UmsMemberReceiveAddress memberReceiveAddress = memberReceiveAddressService.getById(id);

        return ResultUtils.ok().setData(memberReceiveAddress);
    }
}
